//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

namespace Microsoft.Research.ScientificWorkflow.UIDesigner
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Research.ScientificWorkflow.TridentModel;
    using Microsoft.Research.ScientificWorkflow.Validators;

    /// <summary>
    /// Internal class for passing the arguments to the drag target.
    /// </summary>
    internal class ParameterDragInfo
    {
        /// <summary>
        /// Parameter description for the model.
        /// </summary>
        private ParameterDescriptionModel model;

        /// <summary>
        /// Name of the activity.
        /// </summary>
        private string actName;

        private BaseModel sourceActivityModel;

        private bool validationRequired;

        private List<BindingValidator> validateBindings;

        /// <summary>
        /// Encapsulates the parameter being dragged.
        /// </summary>
        /// <param name="model">
        /// Description object for the model being dragged.
        /// </param>
        /// <param name="actName">
        /// Name of the activity.
        /// </param>
        public ParameterDragInfo(
            ParameterDescriptionModel model, 
            BaseModel sourceModel,
            bool validationRequired,
            List<BindingValidator> validateBinding)
         {
            this.model = model;
            this.actName = sourceModel.UniqueId;
            this.sourceActivityModel = sourceModel;
            this.validationRequired = validationRequired;
            this.validateBindings = validateBinding;
        }

        /// <summary>
        /// Gets the model being dragged.
        /// </summary>
        public ParameterDescriptionModel Model
        {
            get
            {
                return this.model;
            }
        }

        /// <summary>
        /// Gets the name of the activity.
        /// </summary>
        public string ActivityName
        {
            get
            {
                return this.actName;
            }
        }

        /// <summary>
        /// Gets the model being dragged.
        /// </summary>
        public BaseModel SourceModel
        {
            get
            {
                return this.sourceActivityModel;
            }
        }

        /// <summary>
        /// Gets teh Validate Bindings list.
        /// </summary>
        public List<BindingValidator> ValidateBindings
        {
            get
            {
                if (null == this.validateBindings)
                {
                    this.validateBindings = new List<BindingValidator>();
                }

                return this.validateBindings;
            }
        }

        public bool ValidationRequired
        {
            get { return validationRequired; }
            set { validationRequired = value; }
        }
    }
}
